﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using DAL;
using Utility;
namespace BUS
{
    public class Tbl_HTTT_BUS
    {
        public static tbl_HTTTCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            Tbl_HTTT_DAL htDAL = new Tbl_HTTT_DAL();
            return htDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbl_HTTTCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            Tbl_HTTT_DAL htDAL = new Tbl_HTTT_DAL();
            return htDAL.Get(cri.Criter, 0, 0, tbl_HTTTColumns.STT.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static Tbl_HTTT_Entities GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbl_HTTTColumns.STT.ToString(), Condition.EQUAL, iD);
            Tbl_HTTT_DAL htDAL = new Tbl_HTTT_DAL();
            tbl_HTTTCollection htCollection = htDAL.Get(cri.Criter, 0, 0, tbl_HTTTColumns.STT.ToString(), OrderDirection.ASC.ToString(), out total);
            if (htCollection.Count > 0)
                return htCollection[0];
            return null;
        }

        public static void Insert(Tbl_HTTT_Entities ht)
        {
            Tbl_HTTT_DAL htDAL = new Tbl_HTTT_DAL();
            htDAL.insert(ht);
        }
        public static void Update(Tbl_HTTT_Entities ht)
        {
            Tbl_HTTT_DAL htDAL = new Tbl_HTTT_DAL();
            htDAL.Update(ht);
        }
        public static void Delete(int id)
        {
            Tbl_HTTT_DAL htDAL = new Tbl_HTTT_DAL();
            htDAL.Delete(id);
        }
    }
}

